package icom.acm.demo.serverpush.action;

import java.io.IOException;

import icom.acm.demo.serverpush.User;
import icom.acm.demo.serverpush.form.UserForm;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserAction  extends icom.acm.myaction.Action{
	public UserAction(){}
	
	public UserAction(HttpServletRequest req, HttpServletResponse resp) {super(req, resp);}
	
	public void login(UserForm uf) throws IOException, ServletException{
		User user = new User();
		user.setName(uf.getName());
		session.setAttribute("user", user);
		
		System.out.println("session Add " + user.getName());
		
		dispatcher = request.getRequestDispatcher("main.jsp");			
		dispatcher.forward(request, response);
		
	}
	
}
